<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <!-- Font Awesome -->
    <link rel="stylesheet" th:href="@{/plugins/fontawesome-free/css/all.min.css}">
    <!-- bootstarp table -->
    <link rel="stylesheet" th:href="@{/plugins/bootstrap-table/bootstrap-table.min.css}">
    <!-- 主题样式 -->
    <link rel="stylesheet" th:href="@{/AdminLTE/css/adminlte.min.css}">
    <link th:href="@{/service/css/viewer.min.css}" rel="stylesheet">
</head>
<body>
<div id="box">

    <img src="/AdminLTE/img/photo2.png" width="150px"/>
</div>
    <table id="myTable"></table>

    <!-- jQuery -->
    <script th:src="@{/plugins/jquery/jquery.min.js}"></script>
    <!-- Bootstrap 4 -->
    <script th:src="@{/plugins/bootstrap/js/bootstrap.bundle.min.js}"></script>
    <!-- Bootstrap table 4 -->
    <script th:src="@{/plugins/bootstrap-table/bootstrap-table.min.js}"></script>
    <script th:src="@{/plugins/bootstrap-table/bootstrap-table-zh-CN.min.js}"></script>

    <!-- viewer 图片放大 -->
    <script th:src="@{/service/js/viewer.min.js}"></script>

    <script>
        $(function (){
            /*查看大图*/
            var image = new Viewer(document.getElementById('box'), {
                button: true,
                navbar: false,
                width: 660,
                title: false
            });
        })
        let t = $("#myTable").bootstrapTable({
            columns: [
                {
                    title: "id",
                    field: "id",
                    width: 200

                },
                {
                    title: "name",
                    field: "name"
                },
                {
                    title: "用户名",
                    field: "username"
                },
                {
                    title: "phone",
                    field: "phone",
                    formatter: function(value){
                        return value.substr(0, 3) + '****' + value.substr(7,4);
                    }
                },
            ],
            // data: [
            //     { id : 'aaa', name: '张三'},
            //     { id : 'bbb', name: '李四'},
            //     { id : 'ccc', name: '王五'},
            // ]
            url: '/sysuser/list',
            responseHandler: function (res){
                console.log(res)
                if (res.code == 200){
                    return {
                        total: 0,
                        rows:  res.data.list
                    };
                } else{
                    return {
                        rows: []
                    }
                }

            }
        });
    </script>
</body>
</html>